package com.wisezone.java1902.d13_sort1;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class TestUserTwo {

	public static void main(String[] args) {
		User user1 = new User("小明", 22);
		User user2 = new User("小丽", 23);
		User user3 = new User("张三", 21);
		User user4 = new User("李四", 20);

		List<User> userLists = new ArrayList<>(); // 动态数组容器
		userLists.add(user1);
		userLists.add(user2);
		userLists.add(user3);
		userLists.add(user4);

		Collections.sort(userLists);
		System.out.println("排序之后");

		for (User user : userLists) {
			System.out.println(user);
		}
	}

}
